%cd ../../../data/StateTransitionExercise
A = xlsread('transitiona_matrix_year.xlsx', 'B1:AN1');
A = reshape(A,size(A,2)/3,3);
all = A(1,:);
A = A(2:end,:);
B1 = reshape(A(:,1),4,3);
B2 = reshape(A(:,2),4,3);
B3 = reshape(A(:,3),4,3);
T = [B1(1,:); B2(1,:); B3(1,:)];
T = T./repmat(sum(T,2),1,3);

TT = zeros(9,9);
for i=1:3
    for j=1:3
        eval(['TT(3*(i-1)+j,3*(j-1)+1:3*(j-1)+3)=B',num2str(i),'(2:end,j)'';']);
    end;
end;

TT = TT./repmat(sum(TT,2),1,9);

save transition_matrices.mat T TT 

